/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package robot;

import java.io.IOException;
import java.io.OutputStream;
import javax.swing.JTextArea;

/**
 *
 * @author janburkot
 */
public class TextAreaOutputStream extends OutputStream {
    
    private JTextArea textArea;
    
    public TextAreaOutputStream(JTextArea area){
        textArea = area;
    }
    
    @Override
    public void write(int b) throws IOException {
        textArea.append(String.valueOf((char) b));
    }
    
    @Override
    public void write(byte[] b) throws IOException {
        write(b, 0, b.length); 
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        textArea.append(new String(b, off, len));
    }

}
